<template>
	<view class="wrok">
		<u-tabs :list="type" :scrollable="false" @click="clicklook"></u-tabs>
		<view class="r1" v-show="key1">
			<swiper indicator-dots :circular="true" :autoplay="true" interval="3000">
				<swiper-item v-for="item in lun">
					<image :src="'http://124.93.196.45:10001'+item.advImg" style="width: 100%; height: 100%;"></image>
				</swiper-item>
			</swiper>
			<u-search @search="search" @custom="search" v-model="value"></u-search>
			<view class="w1" v-for="item in list" @click="tonext(item.id,item.companyName)">
				<text>职位名称：{{item.professionName}}</text>
				<text>岗位职责：{{item.obligation}}</text>
				<text>公司地点：{{item.address}}</text>
				<text>薪资待遇：{{item.salary}}</text>
			</view>
		</view>
		<view class="r2" v-show="key2">
			1
		</view>
		<view class="r3" v-show="key3">
			<u-search></u-search>
			<text style="font-size: 28px;">基本信息：</text>
			<view class="w2">
				<text>用户昵称：</text>
				<input placeholder="请输入用户昵称"/>
			</view>
			<u-line></u-line>
			<view class="w2">
				<text>邮箱：</text>
				<input placeholder="请输入邮箱"/>
			</view>
			<u-line></u-line>
			<view class="w2">
				<text>电话号码：</text>
				<input placeholder="请输入电话号码"/>
			</view>
			<u-line></u-line>
			<view class="w2">
				<text>性别：</text>
				<input placeholder="请输入性别"/>
			</view>
			<u-line></u-line>
			<text style="font-size: 28px;">求职信息:</text>
			<view class="w2">
				<text>工作经验：</text>
				<input placeholder="请输入工作经验"/>
			</view>
			<u-line></u-line>
			<view class="w2">
				<text>最高学历：</text>
				<input placeholder="请输入最高学历"/>
			</view>
			<u-line></u-line>
			<view class="w2">
				<text>现居住地：</text>
				<input placeholder="请输入现居住地"/>
			</view>
			<u-line></u-line>
			<view class="w2">
				<text>期望职位：</text>
				<input placeholder="请输入期望职位"/>
			</view>
			<u-line></u-line>
			<view class="w2">
				<text>期望薪资：</text>
				<input placeholder="请输入期望薪资"/>
			</view>
			<u-line></u-line>
			<view class="w2">
				<text>教育经历：</text>
				<input placeholder="请输入教育经历"/>
			</view>
			<u-line></u-line>
			<view class="w2">
				<text>个人简介：</text>
				<input placeholder="请输入个人简介"/>
			</view>
			<u-line></u-line>
			<u-button type="primary" text="保存"></u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				lun:[],
				list:[],
				alllist:[],
				value:'',
				type:[
					{
						name:'找工作'
					},
					{
						name:'投递记录'
					},
					{
						name:'个人简历'
					}
				],
				key1:true,
				key2:false,
				key3:false
			}
		},
		onLoad() {
			this.getlun()
			this.getlist()
		},
		methods: {
			getlun(){
				this.api.get('/prod-api/api/rotation/list').then(res=>{
					this.lun=res.data.rows
				})
			},
			getlist(){
				this.api.get('/prod-api/api/job/post/list').then(res=>{
					this.list=res.data.rows
					this.alllist=res.data.rows
				})
			},
			search(){
				if(this.value===''){
					this.list=this.alllist
				}else{
					this.list=[]
					for(let i=0;i<this.alllist.length;i++){
						if(this.alllist[i].professionName.indexOf(this.value)>=0){
							this.list.push(this.alllist[i])
						}
					}
				}
			},
			clicklook(e){
				if(e.index===0){
					this.key1=true
					this.key2=false
					this.key3=false
				}else if(e.index===1){
					this.key1=false
					this.key2=true
					this.key3=false
				}else{
					this.key1=false
					this.key2=false
					this.key3=true
				}
			},
			tonext(id,name){
				uni.navigateTo({
					url:'/pages/other/work/wrokdetail/wrokdetail?id='+id+'&name='+name
				})
			}
		}
	}
</script>

<style lang="scss">
.w1{
	display: flex;
	flex-direction: column;
	width: 300px;
	margin: 20px auto;
	border: 2px solid hotpink;
	line-height: 28px;
	// border-radius: 10px;
}
.w2{
	display: flex;
	margin-top: 20px;
	margin-bottom: 20px;
}
</style>
